package 常用类.Array类.linkedList;

import java.util.LinkedList;

public class LinkdeeListDome1 {
    public static void main(String[] args) {
        //LinkedList基于链表实现
        LinkedList<String> linkedList=new LinkedList<>();
        linkedList.add("a");//向当前列表的尾部插入
        linkedList.addFirst("aaa");//首部添加
        linkedList.addLast("bbb");//尾部添加
        linkedList.add("ccc");//(add和addLast)效果相同
        System.out.println(linkedList);
        System.out.println(linkedList.getFirst());
        System.out.println(linkedList.getLast());
        System.out.println(linkedList.get(2));
    }
}
